package com.nd.mobile.study.view.helper;

import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import com.nd.mobile.study.R;

public class AnimHelper {
	public static View setViewTouchAnim(View view) {
		view.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_DOWN) {
					if (v.getAnimation() == null) {
						Animation anim = AnimationUtils.loadAnimation(v.getContext(), R.anim.tab_anim);
						v.setAnimation(anim);
					} else {
						if (v.getAnimation() != null) {
							v.getAnimation().start();
						}
					}
				}
				return false;
			}
		});
		return view;
	}
}
